const PathResolve = require('path').resolve
const RxFileWrite = require('rxfile-write')

const ACC_KEY_PATH = PathResolve(__dirname, '..', '..', 'AccessKey')

function GetAccKey() {
  return new Promise((resolve, reject) => {
    RxFileWrite.read(ACC_KEY_PATH).then(key => {
      key = key || ''
      key = key.replace(/\ +/g, '').replace(/[\r\n]\ +/g, '')
      resolve(key)
    }).catch(reject)
  })
}

module.exports = GetAccKey